//
//  IvanSqliteDB.h
//  YuchBox
//
//  Created by Ivan on 11-10-19.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "/usr/include/sqlite3.h"
#import "Utility.h"

#define SQLITE_TEXT_ESCAPED(nsstring)   [NSString stringWithUTF8String:sqlite3_mprintf("%q", [nsstring UTF8String])]

#define IVAN_DB [IvanSqliteDB sharedIvanSqliteDB]
@interface IvanSqliteDB : NSObject
{
    sqlite3 *_db;
}

+ (IvanSqliteDB *)sharedIvanSqliteDB;
+ (void)createDBEnvironment;

- (id)initSingleton;

- (UInt64)getLastInsertRowid;
- (Boolean)connect;
- (Boolean)checkConnection;
//- (void)queryWithSql:(NSString *)sql;
- (Boolean)updateWithSql:(NSString *)sql;
- (Boolean)insertWithSql:(NSString *)sql;
- (sqlite3_stmt *)prepareSelect:(NSString *)sql;
@end
